import React, { Component } from 'react'
// 引入页面组件
import Home from '../router-view1/Home';
import Category from '../router-view1/Category';
import Car from '../router-view1/Car';
import Mine from '../router-view1/Mine';
import Notfind from '../router-view1/Notfind';

import { Route, Redirect, Switch } from 'react-router-dom'
export default class Index extends Component {
    render() {
        return (
            // Switch组件, 保证路由从上到下只匹配一个路由, 匹配后就不在往后匹配了
            <Switch>
                <Route path='/home' component={Home}></Route>
                <Route path='/category/:id/:id1?' component={Category}></Route>
                <Route path='/car' component={Car}></Route>
                <Route path='/mine' component={Mine}></Route>
                {/* 重定向组件 exact表示严格模式 */}
                <Redirect from='/' to='/home' exact></Redirect>
                {/* 定义404 规则 */}
                <Route component={Notfind}></Route>
            </Switch>
        )
    }
}
